(define (make-point x y)
  (cons x y))
(define (make-segment p1 p2)
  (cons p1 p2))
(define (make-rectangle s1 s2)
  (cons (get-length s1)
        (get-length s2)))
(define (get-length s)
  (sqrt (+ (square (- (car (car s)) (car (cdr s))))
           (square (- (cdr (car s)) (cdr (cdr s)))))))
(define (perimeter r)
  (* 2 (+ (car r)
          (cdr r))))
(define (area r)
  (* (car r)
     (cdr r)))

;test
(define a (make-point 0 0))
(define b (make-point 0 1))
(define c (make-point 2 1))
(define s1 (make-segment a b))
(define s2 (make-segment b c))
(define r (make-rectangle s1 s2))
(newline)
(display (perimeter r))
(newline)
(display (area r))
